import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'app-inner-directive',
    templateUrl: './inner-directive.component.html',
    styleUrls: ['./inner-directive.component.less']
})
export class InnerDirectiveComponent implements OnInit {
    classStr="fctest fc fs bc border";
    classArr=["fctest","fc","fs","bc","border"];
    classObj={
        fctest:true,
        fc:true,
        fs:true,
        bc:true,
        border:true
    }
    styleObj={
        color:"green",
        "font-size":"20px",
        backgroundColor:"#ccc"
    };
    flag=true;
    num=0;
    name="林志颖";
    arr=["杨超越","景甜","吴宣仪","赵露思"];
    size=4;
    str="asahdhja";
    obj={
        name:"林志颖",
        age:46
    }
    constructor() { }

    ngOnInit() {
    }
    removeClass(arg){
        if(this.classStr.indexOf(arg)==-1){
            this.classStr=this.classStr+" "+arg;
        }else{
            this.classStr=this.classStr.replace(arg,"");
        }
    }
    removeClassArr(arg){
        let i=this.classArr.indexOf(arg);
        if(i==-1){
            this.classArr.push(arg);
        }else{
            this.classArr.splice(i,1);
        }
    }
    getSizeArr(){
        let arr1=[];
        arr1.length=this.size;
        return arr1;
    }
    getStrArr(){
        return this.str.split("");
    }
    getObjArr(arg){
        let arr2;
        if(arg=="keys"){
            arr2=Object.keys(this.obj);
        }
        if(arg=="values"){
            arr2=Object.values(this.obj);
        }
        if(arg=="entries"){
            arr2=Object.entries(this.obj);
            // console.log(arr2);
        }
        return arr2;
    }
}
